/**
 * 远程接口数据访问对象
 */
import Cache from './cache.js'

var RemoteDAO = {};

RemoteDAO.alert = function() {
  console.log('****remoteDAO****');
}

/**
 * 我的账户 13100007
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100007 = function(obj, callback) {
  if (Cache.useCache('callZL13100007', obj, callback))
    return

  let param = {
    "func_id": "13100007",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100007', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 账户分析时间段 13100031
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100031 = function(obj, callback) {
  if (Cache.useCache('callZL13100031', obj, callback))
    return

  var param = {
    "func_id": "13100031",
    "pagenum": '5', //1-quarter,2-halfyear,3-month,4-year,5-CURMONTH   //2016年?
    "pagesize": '1'
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100031', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益能力-我的收益率 13100010  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100010 = function(obj, callback) {
  if (Cache.useCache('callZL13100010', obj, callback))
    return

  var param = {
    "func_id": "13100010",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100010', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益能力-沪深300指数收益率 13100011  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100011 = function(obj, callback) {
  if (Cache.useCache('callZL13100011', obj, callback))
    return

  var param = {
    "func_id": "13100011",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100011', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 资产分析-月度分析  13100040     ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100040 = function(obj, callback) {
  if (Cache.useCache('callZL13100040', obj, callback))
    return

  var param = {
    "func_id": "13100040",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100040', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 月度沪深300收益率 13100041    ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100041 = function(obj, callback) {
  if (Cache.useCache('callZL13100041', obj, callback))
    return

  var param = {
    "func_id": "13100041",
    "recent": obj.recent //格式YYYYMM  测试环境必须是201705有数据 否则hits为空
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100041', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 资产分析-我的资产 13100042   出参应该是day_profit_total，已确认。
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100042 = function(obj, callback) {
  if (Cache.useCache('callZL13100042', obj, callback))
    return

  var param = {
    "func_id": "13100042",
    'pagenum': obj.pagenum,
    'pagesize': '1',
    "tradedate": obj.tradedate //格式是否正确
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100042', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益top榜-股票 13100048   入参top_number不要 ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100048 = function(obj, callback) {
  if (Cache.useCache('callZL13100048', obj, callback))
    return

  var param = {
    "func_id": "13100048",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100048', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益top榜-每日收益额走势图 13100030  OK  客户1857356数据已加
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100030 = function(obj, callback) {
  if (Cache.useCache('callZL13100030', obj, callback))
    return

  var param = {
    "func_id": "13100030",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "tradedate": obj.tradedate,
    "stock_code": obj.stock_code,
    "market_code": obj.market_code //市场代码 参照大数据接口文档的数据字典 上海A股-1 深圳A股-2 上海B股-3 深圳B股-4 沪港通-5
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100030', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 亏损top榜-股票 13100038
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100038 = function(obj, callback) {
  if (Cache.useCache('callZL13100038', obj, callback))
    return

  var param = {
    "func_id": "13100038",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100038', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益top榜-理财 13100049  入参top_number不要
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100049 = function(obj, callback) {
  if (Cache.useCache('callZL13100049', obj, callback))
    return

  var param = {
    "func_id": "13100049",
    "recent": obj.recent,
    "pagenum": obj.pagenum,
    "pagesize": "1"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100049', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 亏损top榜-理财 13100039  ok 入参top_number不用传
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100039 = function(obj, callback) {
  if (Cache.useCache('callZL13100039', obj, callback))
    return

  var param = {
    "func_id": "13100039",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100039', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 资产分析-我的标签 13100044
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100044 = function(obj, callback) {
  if (Cache.useCache('callZL13100044', obj, callback))
    return

  var param = {
    "func_id": "13100044",
    "recent": obj.recent,
    "pagenum": obj.pagenum,
    "pagesize": "1"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100044', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 资产分析-股票操作 13100043   ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100043 = function(obj, callback) {
  if (Cache.useCache('callZL13100043', obj, callback))
    return

  var param = {
    "func_id": "13100043",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        Cache.saveCache('callZL13100043', obj, response);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 我的账户-账户评级 13100019 OK
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100019 = function(obj, callback) {
  var param = {
    "func_id": "13100019",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 收益能力 13100009  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100009 = function(obj, callback) {
  var param = {
    "func_id": "13100009",
    "pagenum": "30",
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 选股能力 13100014  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100014 = function(obj, callback) {
  var param = {
    "func_id": "13100014",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 仓位控制-我的仓位 13100021 ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100021 = function(obj, callback) {
  var param = {
    "func_id": "13100021",
    "pagenum": "30",
    "pagesize": "1",
    "tradedate": obj.tradedate
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 仓位控制-沪深300指数 13100022 ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100022 = function(obj, callback) {
  var param = {
    "func_id": "13100022",
    "pagenum": "30",
    "pagesize": "1",
    "tradedate": obj.tradedate
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 仓位控制 13100020 ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100020 = function(obj, callback) {
  var param = {
    "func_id": "13100020",
    "pagenum": "30",
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 盘面感知-买入分布 13100023    ok "match_in_amt"不要传
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100023 = function(obj, callback) {
  var param = {
    "func_id": "13100023",
    "pagenum": '30',
    "pagesize": "1",
    "tradedate": obj.tradedate
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 盘面感知-买出分布 13100024    ok  "match_in_amt"不要传
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100024 = function(obj, callback) {
  var param = {
    "func_id": "13100024",
    "pagenum": "30",
    "pagesize": "1",
    "tradedate": obj.tradedate
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 盘面感知-总结 13100015  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100015 = function(obj, callback) {
  var param = {
    "func_id": "13100015",
    "pagenum": "30",
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 风险控制 13100025   //出参少sharpe_rate_label
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100025 = function(obj, callback) {
  var param = {
    "func_id": "13100025",
    "pagenum": obj.pagenum,
    "pagesize": "1",
    "recent": obj.recent
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 股票分析 13100045  测试环境给前端返回为：sum_day_profit, sum_is_hold。stock_name_group变为key。600795-1-国电电力。 上生产后需要注意出参字段名是否和测试环境一致。
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100045 = function(obj, callback) {
  var param = {
    "func_id": "13100045",
    "tradedate": obj.tradedate,
    "pagenum": obj.pagenum,
    "pagesize": obj.pagesize
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "assetAnalysis",
    "tranCode": "GT1003",
    "jsToken": "6",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 证券交易对账单 13100001
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100001 = function(obj, callback) {
  var param = {
    "func_id": "13100001",
    "pagenum": "30",
    "pagesize": "1",
    "bizdate": obj.bizdata,
    "matchamt": "0-1000000000000000",
    "stkcode": obj.stkcode
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 证券交易成交 13100016
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100016 = function(obj, callback) {
  var param = {
    "func_id": "13100016",
    "pagenum": obj.pagenum,
    "pagesize": obj.pagesize,
    "digestid": "220000,221001",
    "bizdate": obj.bizdate,
    "stkcode": obj.stkcode
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "custid"
    }
  });
}

/**
 * 股票分析_交易明细曲线图 13100046   二期  ok
 *
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100046 = function(obj, callback) {
  var param = {
    "func_id": "13100046",
    "tradedate": obj.tradedate,
    "stock_code": obj.stock_code,
    "market_code": obj.market_code,
    "pagenum": "100",
    "pagesize": "1"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 股票分析_交易明细汇总  13100047   新增
 * @param obj
 * @param callback
 */
RemoteDAO.callZL13100047 = function(obj, callback) {
  var param = {
    "func_id": "13100047",
    "tradedate": obj.tradedate,
    "stock_code": obj.stock_code,
    "market_code": obj.market_code,
    "pagenum": '1',
    "pagesize": "1"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data);
        response.data = decrypt.json(string);
        // console.log("股票分析_交易明细汇总 13100047",response.data);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 *  分享
 * @param title     分享题目
 * @param content   分享的内容
 * @param icon      分享的图标
 * @param linkurl   链接
 * @param moments 表示分享到朋友圈是使用title还是content,或是都拼在一起  title/content/all
 */
RemoteDAO.share = function(obj) {
  window.location.href = 'gtjayyznormal://yyzShare?title=' + obj.title + '&content=' + obj.content + '&moments=' + obj.moments + '&icon=' + obj.icon + '&linkurl=' + obj.linkurl;
};

/**
 * 客户总资产查询(分大类) 12006012
 * 入参：：MONEY_TYPE，0表示人民币
 * 出参：：TOTAL_ASSET：总资产。FUND_ASSET：现金资产。STOCK_ASSET：证券资产。FINANCE_ASSET：理财资产。
 * @param obj
 * @param callback
 */
RemoteDAO.callUC12006012 = function(obj, callback) {
  var param = {
    "func_id": "12006012",
    "MONEY_TYPE": "0"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        // console.log("客户总资产查询: ",response.data);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "CUST_CODE",
      "busin_account": "CUACCT_CODE"
    }
  });
}

/**
 * 银行转账流水查询 10500009
 * 入参：：公共入参，没有额外入参
 * 出参：：bank_name：银行。entrust_time：时间。bktrans_status：请求状态。occur_balance：金额。trans_type：交易类型(买卖方向)。
 * 注：：判断payorgan_id，当为空，是三方，根据occur_balance金额正负判断买卖方向；当不为空，是非三方，根据trans_type交易类型判断买卖方向。
 * @param obj
 * @param callback
 */
RemoteDAO.callZL10500009 = function(obj, callback) {
  var param = {
    "func_id": "10500009"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != '1') {
        let string = JSON.stringify(response.data); //解析出字符串
        response.data = decrypt.json(string);
        // console.log("银行转账流水查询: ",response.data);
      }
      callback(response);
    },
    "id": "analysis",
    "tranCode": "GT1001",
    "jsToken": "2",
    "isEncrypt": "false",
    "transmitMode": "get",
    'param': param,
    "publicParameter": {
      "client_id": "customer_no"
    }
  });
}

/**
 * 查询当日盈亏和上个交易日总资产
 * 入参：：money_type，0表示人民币。
 * 出参：：TOTAL_ASSET：T日总资产。ASSET_TOTAL_RMB：(T-1)日总资产。TOTAL_EFFECT：(T日转入-T日转出)。
 * 计算公式：：当日盈亏＝T日总资产-(T-1)日总资产-(T日转入-T日转出)
 * @param obj
 * @param callback
 */
RemoteDAO.callGT1002 = function(obj, callback) {
  var param = {
    "money_type": "0"
  };
  Bridge.callByJS({
    callback: function(response) {
      if (response.error != 1) {
        let string = JSON.stringify(response.data);
        response.data = decrypt.json(string);
        // console.log("查询当日盈亏和上个交易日总资产: ",response.data);
      }
      callback(response)
    },
    "id": "user_portrait",
    "tranCode": "GT1002",
    "jsToken": "1",
    "isEncrypt": "false",
    "transmitMode": "post",
    "param": param,
    "publicParameter": {}
  });
}

/**
 * 获取沪市／深市／创业板 实时行情指数
 * @param callback
 */
RemoteDAO.callNativeIndex = function(obj, callback) {
  Bridge.callByJsUrl('gtjahq://getIndexData?jstoken=1', function(response) {
    callback(response);
  }, '1')
}

/**
 *  K线图数据
 * @param callback
 */
RemoteDAO.callNativeKLine = function(stock, callback) {
  Bridge.callByJsUrl('gtjahq://getKList?stockcode=' + stock + '&type=2&period=60&onedate=0&jstoken=1', function(response) {
    callback(response);
  }, '1')
};

/**
 *  持仓变动
 * @param callback
 */
 RemoteDAO.callNativePosChange = function(callback) {
   console.log('进了RemoteDAO里面的callNativePositionChange，但是还没进Bridge');
   Bridge.callByJsUrl('gtjazcfx://getPositionChange?isNewShare=0&jstoken=1', function(response) {
     console.log('进了callNativePositionChange里面的Bridge',response);
     callback(response);
   }, '1')
 }

export default RemoteDAO
